package com.itrip.biz.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itrip.beans.pojo.Hotel;
import com.itrip.beans.pojo.HotelRoom;
import com.itrip.beans.pojo.LabelDic;
import com.itrip.biz.service.HotelService;
import com.itrip.dao.HotelMapper;
import com.itrip.dao.HotelRoomMapper;
import com.itrip.dao.LabelDicMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class HotelServiceImpl extends ServiceImpl<HotelMapper, Hotel> implements HotelService {
    @Resource
    private HotelRoomMapper hotelRoomMapper;
    @Resource
    private LabelDicMapper labelDicMapper;

    @Override
    public List<HotelRoom> getHotelRoomListByMap(Map<String,Object> param)throws Exception{
        return hotelRoomMapper.getHotelRoomListByMap(param);
    }

    @Override
    public List<LabelDic> queryHotelDetails(String Id) {
        List<LabelDic> list=labelDicMapper.getHotelFeatureByHotelId(Long.valueOf(Id));
        LabelDic labelDic=new LabelDic();
        Hotel hotel=this.getById(Long.valueOf(Id));
        labelDic.setName("酒店介绍");
        labelDic.setDescription(hotel.getDetails());
        list.add(1,labelDic);
        return list;
    }
}
